class cDate:
    def __init__(self,y,m,d):
        self.__year=y
        self.__month=m
        self.__day=d
    def setyear(self,y):
        if(y>=1):
            self.__year=y
        else:
            print("输入错误！")
    def setmonth(self,m):
        if(m>=1 and m<=12):
            self.__month=m
        else:
            print("输入错误！")
    def setday(self,d):
        #if(m)根据年月改时间
        if(d>=1 and d<=31):
            self.__day=d
        else:
            print("输入错误！")
    def getday(self):
        return self.__day
    def getyear(self):
        return self.__year
    def getmonth(self):
        return self.__month
    month=property(getmonth,setmonth)
    def __str__(self):
        y=2021
        m=5
        d=29
        return f"{self.__year}-{self.__month}-{self.__day}"
    def __sub__(self,other):   #日期减法后的天数
        return ((self.__day-other.__day)+(self.__month-other.__month)*30+(self.__year-other.__year)*365)
    def __add__(self,other):    #日期加法
        if(self.__day+other.__day>30):   #判断是否符合
            self.__month+=1
        if(self.__month+other.__month>12):
            self.__year+=1
        return f"{self.__year+other.__year}-{(self.__month+other.__month)%12}-{(self.__day+other.__day)%30}"
    def __eq__(self,other):
        return ((self.__year<other.__year)) 
print("软工2020-01-05郭枫")
d1=cDate(2001,9,12)
d2=cDate(2002,11,12)
s=str(d1)
print(d1)
print(d1-d2)
s2=str(d1+d2)
print(d1+d2)
#借书还书
d3=cDate(int(input("请输入借书日：",)))
change = input("是否要更改日期,请回答Y或者N: ").upper()
if change == "Y":
    d3=cDate(int(input("请输入续借后日期：")))
d4=cDate(int(input("请输入借书日：")))
#比较还书借书时间
if(d4-d3>90):
    print("未正常还书")
    money=(d4-d3-90)*0.1
    print(money)
else:
    print("正常还书")